<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>API: container   Panel.js  (YUI Library)</title>
	<link rel="stylesheet" type="text/css" href="assets/api.css">
</head>

<body id="yahoo-com">
<div id="doc3" class="yui-t2">

	<div id="hd">
        <h1>Yahoo! UI Library</h1>
        <h3>Container&nbsp; <span class="subtitle">2.2.2</span></h3>
        <p>
        <a href="./index.html">Yahoo! UI Library</a> 
            &gt; <a href="./module_container.html">container</a>
                
                 &gt; Panel.js (source view) 
            </p>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">

                    <div id="srcout">
<div class="highlight" ><pre><span class="c">/**</span>
<span class="c">* Panel is an implementation of Overlay that behaves like an OS window, with a draggable header and an optional close icon at the top right.</span>
<span class="c">* @namespace YAHOO.widget</span>
<span class="c">* @class Panel</span>
<span class="c">* @extends YAHOO.widget.Overlay</span>
<span class="c">* @constructor</span>
<span class="c">* @param {String}	el	The element ID representing the Panel &lt;em&gt;OR&lt;/em&gt;</span>
<span class="c">* @param {HTMLElement}	el	The element representing the Panel</span>
<span class="c">* @param {Object}	userConfig	The configuration object literal containing the configuration that should be set for this Panel. See configuration documentation for more details.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">userConfig</span><span class="o">)</span> <span class="o">{</span>
	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">constructor</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">el</span><span class="o">,</span> <span class="nx">userConfig</span><span class="o">);</span>
<span class="o">};</span>

<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">extend</span><span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">,</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Overlay</span><span class="o">);</span>

<span class="c">/**</span>
<span class="c">* Constant representing the default CSS class used for a Panel</span>
<span class="c">* @property YAHOO.widget.Panel.CSS_PANEL</span>
<span class="c">* @static</span>
<span class="c">* @final</span>
<span class="c">* @type String</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">CSS_PANEL</span> <span class="o">=</span> <span class="s2">&quot;yui-panel&quot;</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c">* Constant representing the default CSS class used for a Panel&#39;s wrapping container</span>
<span class="c">* @property YAHOO.widget.Panel.CSS_PANEL_CONTAINER</span>
<span class="c">* @static</span>
<span class="c">* @final</span>
<span class="c">* @type String</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">CSS_PANEL_CONTAINER</span> <span class="o">=</span> <span class="s2">&quot;yui-panel-container&quot;</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c">* Constant representing the name of the Panel&#39;s events</span>
<span class="c">* @property YAHOO.widget.Panel._EVENT_TYPES</span>
<span class="c">* @private</span>
<span class="c">* @final</span>
<span class="c">* @type Object</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">_EVENT_TYPES</span> <span class="o">=</span> <span class="o">{</span>

	<span class="s2">&quot;SHOW_MASK&quot;</span><span class="o">:</span> <span class="s2">&quot;showMask&quot;</span><span class="o">,</span>
	<span class="s2">&quot;HIDE_MASK&quot;</span><span class="o">:</span> <span class="s2">&quot;hideMask&quot;</span><span class="o">,</span>
	<span class="s2">&quot;DRAG&quot;</span><span class="o">:</span> <span class="s2">&quot;drag&quot;</span>

<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Constant representing the Panel&#39;s configuration properties</span>
<span class="c">* @property YAHOO.widget.Panel._DEFAULT_CONFIG</span>
<span class="c">* @private</span>
<span class="c">* @final</span>
<span class="c">* @type Object</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">_DEFAULT_CONFIG</span> <span class="o">=</span> <span class="o">{</span>

    <span class="s2">&quot;CLOSE&quot;</span><span class="o">:</span> <span class="o">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="s2">&quot;close&quot;</span><span class="o">,</span> 
        <span class="nx">value</span><span class="o">:</span><span class="kc">true</span><span class="o">,</span> 
        <span class="nx">validator</span><span class="o">:</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isBoolean</span><span class="o">,</span> 
        <span class="nx">supercedes</span><span class="o">:[</span><span class="s2">&quot;visible&quot;</span><span class="o">]</span> 
    <span class="o">},</span>

    <span class="s2">&quot;DRAGGABLE&quot;</span><span class="o">:</span> <span class="o">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="s2">&quot;draggable&quot;</span><span class="o">,</span> 
        <span class="nx">value</span><span class="o">:(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">DD</span> <span class="o">?</span> <span class="kc">true</span> <span class="o">:</span> <span class="kc">false</span><span class="o">),</span> 
        <span class="nx">validator</span><span class="o">:</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isBoolean</span><span class="o">,</span> 
        <span class="nx">supercedes</span><span class="o">:[</span><span class="s2">&quot;visible&quot;</span><span class="o">]</span>  
    <span class="o">},</span>

    <span class="s2">&quot;UNDERLAY&quot;</span><span class="o">:</span> <span class="o">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="s2">&quot;underlay&quot;</span><span class="o">,</span> 
        <span class="nx">value</span><span class="o">:</span><span class="s2">&quot;shadow&quot;</span><span class="o">,</span> 
        <span class="nx">supercedes</span><span class="o">:[</span><span class="s2">&quot;visible&quot;</span><span class="o">]</span> 
    <span class="o">},</span>

    <span class="s2">&quot;MODAL&quot;</span><span class="o">:</span> <span class="o">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="s2">&quot;modal&quot;</span><span class="o">,</span> 
        <span class="nx">value</span><span class="o">:</span><span class="kc">false</span><span class="o">,</span> 
        <span class="nx">validator</span><span class="o">:</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isBoolean</span><span class="o">,</span> 
        <span class="nx">supercedes</span><span class="o">:[</span><span class="s2">&quot;visible&quot;</span><span class="o">]</span> 
    <span class="o">},</span>

    <span class="s2">&quot;KEY_LISTENERS&quot;</span><span class="o">:</span> <span class="o">{</span> 
        <span class="nx">key</span><span class="o">:</span> <span class="s2">&quot;keylisteners&quot;</span><span class="o">,</span> 
        <span class="nx">suppressEvent</span><span class="o">:</span><span class="kc">true</span><span class="o">,</span> 
        <span class="nx">supercedes</span><span class="o">:[</span><span class="s2">&quot;visible&quot;</span><span class="o">]</span> 
    <span class="o">}</span>

<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and  sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.</span>
<span class="c">* @method init</span>
<span class="c">* @param {String}	el	The element ID representing the Overlay &lt;em&gt;OR&lt;/em&gt;</span>
<span class="c">* @param {HTMLElement}	el	The element representing the Overlay</span>
<span class="c">* @param {Object}	userConfig	The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">init</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">userConfig</span><span class="o">)</span> <span class="o">{</span>
	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">init</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">el</span><span class="c">/*, userConfig*/</span><span class="o">);</span>  <span class="c">// Note that we don&#39;t pass the user config in here yet because we only want it executed once, at the lowest subclass level</span>
<span class="c"></span>
	<span class="k">this</span><span class="o">.</span><span class="nx">beforeInitEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">);</span>

	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">CSS_PANEL</span><span class="o">);</span>

	<span class="k">this</span><span class="o">.</span><span class="nx">buildWrapper</span><span class="o">();</span>

	<span class="k">if</span> <span class="o">(</span><span class="nx">userConfig</span><span class="o">)</span> <span class="o">{</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">applyConfig</span><span class="o">(</span><span class="nx">userConfig</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
	<span class="o">}</span>

	<span class="k">this</span><span class="o">.</span><span class="nx">beforeRenderEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>
		<span class="k">var</span> <span class="nx">draggable</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;draggable&quot;</span><span class="o">);</span>
		<span class="k">if</span> <span class="o">(</span><span class="nx">draggable</span><span class="o">)</span> <span class="o">{</span>
			<span class="k">if</span> <span class="o">(!</span> <span class="k">this</span><span class="o">.</span><span class="nx">header</span><span class="o">)</span> <span class="o">{</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">setHeader</span><span class="o">(</span><span class="s2">&quot;&amp;#160;&quot;</span><span class="o">);</span>
			<span class="o">}</span>
		<span class="o">}</span>
	<span class="o">},</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>


    <span class="k">this</span><span class="o">.</span><span class="nx">renderEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>

        <span class="c">/*</span>
<span class="c">            If no value for the &quot;width&quot; configuration property was specified, </span>
<span class="c">            set it to the offsetWidth. If the &quot;width&quot; is not set, then in IE </span>
<span class="c">            you can only drag the panel when you put the cursor on the</span>
<span class="c">            header&#39;s text.</span>
<span class="c">        */</span>

        <span class="k">var</span> <span class="nx">sWidth</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;width&quot;</span><span class="o">);</span>
        
        <span class="k">if</span><span class="o">(!</span><span class="nx">sWidth</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;width&quot;</span><span class="o">,</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">offsetWidth</span> <span class="o">+</span> <span class="s2">&quot;px&quot;</span><span class="o">));</span>
        
        <span class="o">}</span>
    
    <span class="o">});</span>


	<span class="k">var</span> <span class="nx">me</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>

	<span class="k">var</span> <span class="nx">doBlur</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">blur</span><span class="o">();</span>
	<span class="o">};</span>

	<span class="k">this</span><span class="o">.</span><span class="nx">showMaskEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>

		<span class="k">var</span> <span class="nx">checkFocusable</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>

            <span class="k">var</span> <span class="nx">sTagName</span> <span class="o">=</span> <span class="nx">el</span><span class="o">.</span><span class="nx">tagName</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">(),</span>
                <span class="nx">bFocusable</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
            
            <span class="nx">switch</span><span class="o">(</span><span class="nx">sTagName</span><span class="o">)</span> <span class="o">{</span>
            
                <span class="nx">case</span> <span class="s2">&quot;A&quot;</span><span class="o">:</span>
                <span class="nx">case</span> <span class="s2">&quot;BUTTON&quot;</span><span class="o">:</span>
                <span class="nx">case</span> <span class="s2">&quot;SELECT&quot;</span><span class="o">:</span>
                <span class="nx">case</span> <span class="s2">&quot;TEXTAREA&quot;</span><span class="o">:</span>

                    <span class="k">if</span> <span class="o">(!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">isAncestor</span><span class="o">(</span><span class="nx">me</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="nx">el</span><span class="o">))</span> <span class="o">{</span>
                        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">addListener</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="s2">&quot;focus&quot;</span><span class="o">,</span> <span class="nx">doBlur</span><span class="o">,</span> <span class="nx">el</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
                        <span class="nx">bFocusable</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
                    <span class="o">}</span>

                <span class="k">break</span><span class="o">;</span>

                <span class="nx">case</span> <span class="s2">&quot;INPUT&quot;</span><span class="o">:</span>

                    <span class="k">if</span> <span class="o">(</span><span class="nx">el</span><span class="o">.</span><span class="nx">type</span> <span class="o">!=</span> <span class="s2">&quot;hidden&quot;</span> <span class="o">&amp;&amp;</span> <span class="o">!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">isAncestor</span><span class="o">(</span><span class="nx">me</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="nx">el</span><span class="o">))</span> <span class="o">{</span>

                        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">addListener</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="s2">&quot;focus&quot;</span><span class="o">,</span> <span class="nx">doBlur</span><span class="o">,</span> <span class="nx">el</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
                        <span class="nx">bFocusable</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

                    <span class="o">}</span>

                <span class="k">break</span><span class="o">;</span>
            
            <span class="o">}</span>

            <span class="k">return</span> <span class="nx">bFocusable</span><span class="o">;</span>

		<span class="o">};</span>

		<span class="k">this</span><span class="o">.</span><span class="nx">focusableElements</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getElementsBy</span><span class="o">(</span><span class="nx">checkFocusable</span><span class="o">);</span>
	<span class="o">},</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>

	<span class="k">this</span><span class="o">.</span><span class="nx">hideMaskEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>
		<span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span><span class="nx">i</span><span class="o">&lt;</span><span class="k">this</span><span class="o">.</span><span class="nx">focusableElements</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
			<span class="k">var</span> <span class="nx">el2</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">focusableElements</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">removeListener</span><span class="o">(</span><span class="nx">el2</span><span class="o">,</span> <span class="s2">&quot;focus&quot;</span><span class="o">,</span> <span class="nx">doBlur</span><span class="o">);</span>
		<span class="o">}</span>
	<span class="o">},</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>

	<span class="k">this</span><span class="o">.</span><span class="nx">beforeShowEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;underlay&quot;</span><span class="o">);</span>
	<span class="o">},</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
	<span class="k">this</span><span class="o">.</span><span class="nx">initEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">);</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">initEvents</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">initEvents</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>

    <span class="k">var</span> <span class="nx">EVENT_TYPES</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">_EVENT_TYPES</span><span class="o">;</span>

	<span class="c">/**</span>
<span class="c">	* CustomEvent fired after the modality mask is shown</span>
<span class="c">	* @event showMaskEvent</span>
<span class="c">	*/</span>
	<span class="k">this</span><span class="o">.</span><span class="nx">showMaskEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">CustomEvent</span><span class="o">(</span><span class="nx">EVENT_TYPES</span><span class="o">.</span><span class="nx">SHOW_MASK</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>

	<span class="c">/**</span>
<span class="c">	* CustomEvent fired after the modality mask is hidden</span>
<span class="c">	* @event hideMaskEvent</span>
<span class="c">	*/</span>
	<span class="k">this</span><span class="o">.</span><span class="nx">hideMaskEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">CustomEvent</span><span class="o">(</span><span class="nx">EVENT_TYPES</span><span class="o">.</span><span class="nx">HIDE_MASK</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>

	<span class="c">/**</span>
<span class="c">	* CustomEvent when the Panel is dragged</span>
<span class="c">	* @event dragEvent</span>
<span class="c">	*/</span>
	<span class="k">this</span><span class="o">.</span><span class="nx">dragEvent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">CustomEvent</span><span class="o">(</span><span class="nx">EVENT_TYPES</span><span class="o">.</span><span class="nx">DRAG</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Initializes the class&#39;s configurable properties which can be changed using the Panel&#39;s Config object (cfg).</span>
<span class="c">* @method initDefaultConfig</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">initDefaultConfig</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">initDefaultConfig</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>

    <span class="c">// Add panel config properties //</span>
<span class="c"></span>
    <span class="k">var</span> <span class="nx">DEFAULT_CONFIG</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">_DEFAULT_CONFIG</span><span class="o">;</span>

	<span class="c">/**</span>
<span class="c">	* True if the Panel should display a &quot;close&quot; button</span>
<span class="c">	* @config close</span>
<span class="c">	* @type Boolean</span>
<span class="c">	* @default true</span>
<span class="c">	*/</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
                <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">CLOSE</span><span class="o">.</span><span class="nx">key</span><span class="o">,</span>
                <span class="o">{</span> 
                    <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configClose</span><span class="o">,</span> 
                    <span class="nx">value</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">CLOSE</span><span class="o">.</span><span class="nx">value</span><span class="o">,</span> 
                    <span class="nx">validator</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">CLOSE</span><span class="o">.</span><span class="nx">validator</span><span class="o">,</span> 
                    <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">CLOSE</span><span class="o">.</span><span class="nx">supercedes</span>
                <span class="o">}</span> 
            <span class="o">);</span>

	<span class="c">/**</span>
<span class="c">	* True if the Panel should be draggable.  Default value is &quot;true&quot; if the Drag and Drop utility is included, otherwise it is &quot;false.&quot;</span>
<span class="c">	* @config draggable</span>
<span class="c">	* @type Boolean</span>
<span class="c">	* @default true</span>
<span class="c">	*/</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
                <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">DRAGGABLE</span><span class="o">.</span><span class="nx">key</span><span class="o">,</span> 
                <span class="o">{</span> 
                    <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configDraggable</span><span class="o">,</span> 
                    <span class="nx">value</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">DRAGGABLE</span><span class="o">.</span><span class="nx">value</span><span class="o">,</span> 
                    <span class="nx">validator</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">DRAGGABLE</span><span class="o">.</span><span class="nx">validator</span><span class="o">,</span> 
                    <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">DRAGGABLE</span><span class="o">.</span><span class="nx">supercedes</span> 
                <span class="o">}</span> 
            <span class="o">);</span>

	<span class="c">/**</span>
<span class="c">	* Sets the type of underlay to display for the Panel. Valid values are &quot;shadow&quot;, &quot;matte&quot;, and &quot;none&quot;.</span>
<span class="c">	* @config underlay</span>
<span class="c">	* @type String</span>
<span class="c">	* @default shadow</span>
<span class="c">	*/</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
                <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">UNDERLAY</span><span class="o">.</span><span class="nx">key</span><span class="o">,</span> 
                <span class="o">{</span> 
                    <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configUnderlay</span><span class="o">,</span> 
                    <span class="nx">value</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">UNDERLAY</span><span class="o">.</span><span class="nx">value</span><span class="o">,</span> 
                    <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">UNDERLAY</span><span class="o">.</span><span class="nx">supercedes</span>
                <span class="o">}</span> 
            <span class="o">);</span>

	<span class="c">/**</span>
<span class="c">	* True if the Panel should be displayed in a modal fashion, automatically creating a transparent mask over the document that will not be removed until the Panel is dismissed.</span>
<span class="c">	* @config modal</span>
<span class="c">	* @type Boolean</span>
<span class="c">	* @default false</span>
<span class="c">	*/</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
                <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">MODAL</span><span class="o">.</span><span class="nx">key</span><span class="o">,</span>
                <span class="o">{</span> 
                    <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configModal</span><span class="o">,</span> 
                    <span class="nx">value</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">MODAL</span><span class="o">.</span><span class="nx">value</span><span class="o">,</span>
                    <span class="nx">validator</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">MODAL</span><span class="o">.</span><span class="nx">validator</span><span class="o">,</span> 
                    <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">MODAL</span><span class="o">.</span><span class="nx">supercedes</span> 
                <span class="o">}</span> 
            <span class="o">);</span>

	<span class="c">/**</span>
<span class="c">	* A KeyListener (or array of KeyListeners) that will be enabled when the Panel is shown, and disabled when the Panel is hidden.</span>
<span class="c">	* @config keylisteners</span>
<span class="c">	* @type YAHOO.util.KeyListener[]</span>
<span class="c">	* @default null</span>
<span class="c">	*/</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">addProperty</span><span class="o">(</span>
                <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">KEY_LISTENERS</span><span class="o">.</span><span class="nx">key</span><span class="o">,</span> 
                <span class="o">{</span> 
                    <span class="nx">handler</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">configKeyListeners</span><span class="o">,</span> 
                    <span class="nx">suppressEvent</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">KEY_LISTENERS</span><span class="o">.</span><span class="nx">suppressEvent</span><span class="o">,</span> 
                    <span class="nx">supercedes</span><span class="o">:</span> <span class="nx">DEFAULT_CONFIG</span><span class="o">.</span><span class="nx">KEY_LISTENERS</span><span class="o">.</span><span class="nx">supercedes</span>
                <span class="o">}</span> 
            <span class="o">);</span>

<span class="o">};</span>

<span class="c">// BEGIN BUILT-IN PROPERTY EVENT HANDLERS //</span>
<span class="c"></span>
<span class="c">/**</span>
<span class="c">* The default event handler fired when the &quot;close&quot; property is changed. The method controls the appending or hiding of the close icon at the top right of the Panel.</span>
<span class="c">* @method configClose</span>
<span class="c">* @param {String} type	The CustomEvent type (usually the property name)</span>
<span class="c">* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.</span>
<span class="c">* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">configClose</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">args</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
	<span class="k">var</span> <span class="nx">val</span> <span class="o">=</span> <span class="nx">args</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>

	<span class="k">var</span> <span class="nx">doHide</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">e</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
		<span class="nx">obj</span><span class="o">.</span><span class="nx">hide</span><span class="o">();</span>
	<span class="o">};</span>

	<span class="k">if</span> <span class="o">(</span><span class="nx">val</span><span class="o">)</span> <span class="o">{</span>
		<span class="k">if</span> <span class="o">(!</span> <span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">)</span> <span class="o">{</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">close</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;span&quot;</span><span class="o">);</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">,</span> <span class="s2">&quot;container-close&quot;</span><span class="o">);</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&amp;#160;&quot;</span><span class="o">;</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">innerElement</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">);</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">addListener</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">,</span> <span class="s2">&quot;click&quot;</span><span class="o">,</span> <span class="nx">doHide</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
		<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;block&quot;</span><span class="o">;</span>
		<span class="o">}</span>
	<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
		<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">)</span> <span class="o">{</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="o">;</span>
		<span class="o">}</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* The default event handler fired when the &quot;draggable&quot; property is changed.</span>
<span class="c">* @method configDraggable</span>
<span class="c">* @param {String} type	The CustomEvent type (usually the property name)</span>
<span class="c">* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.</span>
<span class="c">* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">configDraggable</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">args</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>

	<span class="k">var</span> <span class="nx">val</span> <span class="o">=</span> <span class="nx">args</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>
	<span class="k">if</span> <span class="o">(</span><span class="nx">val</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">if</span> <span class="o">(!</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">DD</span><span class="o">)</span> <span class="o">{</span>
    
            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;YAHOO.util.DD dependency not met.&quot;</span><span class="o">,</span> <span class="s2">&quot;error&quot;</span><span class="o">);</span>

            <span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;draggable&quot;</span><span class="o">,</span> <span class="kc">false</span><span class="o">);</span>
    
            <span class="k">return</span><span class="o">;</span>
        
        <span class="o">}</span>

		<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">header</span><span class="o">)</span> <span class="o">{</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setStyle</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">header</span><span class="o">,</span><span class="s2">&quot;cursor&quot;</span><span class="o">,</span><span class="s2">&quot;move&quot;</span><span class="o">);</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">registerDragDrop</span><span class="o">();</span>
		<span class="o">}</span>
	<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
		<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">dd</span><span class="o">)</span> <span class="o">{</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">dd</span><span class="o">.</span><span class="nx">unreg</span><span class="o">();</span>
		<span class="o">}</span>
		<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">header</span><span class="o">)</span> <span class="o">{</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setStyle</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">header</span><span class="o">,</span><span class="s2">&quot;cursor&quot;</span><span class="o">,</span><span class="s2">&quot;auto&quot;</span><span class="o">);</span>
		<span class="o">}</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* The default event handler fired when the &quot;underlay&quot; property is changed.</span>
<span class="c">* @method configUnderlay</span>
<span class="c">* @param {String} type	The CustomEvent type (usually the property name)</span>
<span class="c">* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.</span>
<span class="c">* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">configUnderlay</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">args</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
	<span class="k">var</span> <span class="nx">val</span> <span class="o">=</span> <span class="nx">args</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>

	<span class="nx">switch</span> <span class="o">(</span><span class="nx">val</span><span class="o">.</span><span class="nx">toLowerCase</span><span class="o">())</span> <span class="o">{</span>
		<span class="nx">case</span> <span class="s2">&quot;shadow&quot;</span><span class="o">:</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="s2">&quot;matte&quot;</span><span class="o">);</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="s2">&quot;shadow&quot;</span><span class="o">);</span>

			<span class="k">if</span> <span class="o">(!</span> <span class="k">this</span><span class="o">.</span><span class="nx">underlay</span><span class="o">)</span> <span class="o">{</span> <span class="c">// create if not already in DOM</span>
<span class="c"></span>				<span class="k">this</span><span class="o">.</span><span class="nx">underlay</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">);</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">underlay</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;underlay&quot;</span><span class="o">;</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">underlay</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&amp;#160;&quot;</span><span class="o">;</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">underlay</span><span class="o">);</span>
			<span class="o">}</span>

			<span class="k">this</span><span class="o">.</span><span class="nx">sizeUnderlay</span><span class="o">();</span>
			<span class="k">break</span><span class="o">;</span>
		<span class="nx">case</span> <span class="s2">&quot;matte&quot;</span><span class="o">:</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="s2">&quot;shadow&quot;</span><span class="o">);</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="s2">&quot;matte&quot;</span><span class="o">);</span>
			<span class="k">break</span><span class="o">;</span>
		<span class="nx">default</span><span class="o">:</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="s2">&quot;shadow&quot;</span><span class="o">);</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="s2">&quot;matte&quot;</span><span class="o">);</span>
			<span class="k">break</span><span class="o">;</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* The default event handler fired when the &quot;modal&quot; property is changed. This handler subscribes or unsubscribes to the show and hide events to handle the display or hide of the modality mask.</span>
<span class="c">* @method configModal</span>
<span class="c">* @param {String} type	The CustomEvent type (usually the property name)</span>
<span class="c">* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.</span>
<span class="c">* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">configModal</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">args</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
	<span class="k">var</span> <span class="nx">modal</span> <span class="o">=</span> <span class="nx">args</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>

	<span class="k">if</span> <span class="o">(</span><span class="nx">modal</span><span class="o">)</span> <span class="o">{</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">buildMask</span><span class="o">();</span>

		<span class="k">if</span> <span class="o">(!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Config</span><span class="o">.</span><span class="nx">alreadySubscribed</span><span class="o">(</span> <span class="k">this</span><span class="o">.</span><span class="nx">beforeShowEvent</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">showMask</span><span class="o">,</span> <span class="k">this</span> <span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">beforeShowEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">showMask</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
		<span class="o">}</span>
		<span class="k">if</span> <span class="o">(!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Config</span><span class="o">.</span><span class="nx">alreadySubscribed</span><span class="o">(</span> <span class="k">this</span><span class="o">.</span><span class="nx">hideEvent</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">hideMask</span><span class="o">,</span> <span class="k">this</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">hideEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">hideMask</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
		<span class="o">}</span>
		<span class="k">if</span> <span class="o">(!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Config</span><span class="o">.</span><span class="nx">alreadySubscribed</span><span class="o">(</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Overlay</span><span class="o">.</span><span class="nx">windowResizeEvent</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">sizeMask</span><span class="o">,</span> <span class="k">this</span> <span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Overlay</span><span class="o">.</span><span class="nx">windowResizeEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">sizeMask</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
		<span class="o">}</span>
		<span class="k">if</span> <span class="o">(!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Config</span><span class="o">.</span><span class="nx">alreadySubscribed</span><span class="o">(</span> <span class="k">this</span><span class="o">.</span><span class="nx">destroyEvent</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">removeMask</span><span class="o">,</span> <span class="k">this</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">destroyEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">removeMask</span><span class="o">,</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
		<span class="o">}</span>

		<span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;zIndex&quot;</span><span class="o">);</span>
	<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">beforeShowEvent</span><span class="o">.</span><span class="nx">unsubscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">showMask</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">hideEvent</span><span class="o">.</span><span class="nx">unsubscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">hideMask</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
		<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Overlay</span><span class="o">.</span><span class="nx">windowResizeEvent</span><span class="o">.</span><span class="nx">unsubscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">sizeMask</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">destroyEvent</span><span class="o">.</span><span class="nx">unsubscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">removeMask</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Removes the modality mask.</span>
<span class="c">* @method removeMask</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">removeMask</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

    <span class="k">var</span> <span class="nx">oMask</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">;</span>

    <span class="k">if</span><span class="o">(</span><span class="nx">oMask</span><span class="o">)</span> <span class="o">{</span>
    
        <span class="c">/*</span>
<span class="c">            Hide the mask before destroying it to ensure that DOM</span>
<span class="c">            event handlers on focusable elements get removed.</span>
<span class="c">        */</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">hideMask</span><span class="o">();</span>
    
        <span class="k">var</span> <span class="nx">oParentNode</span> <span class="o">=</span> <span class="nx">oMask</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">;</span>

        <span class="k">if</span><span class="o">(</span><span class="nx">oParentNode</span><span class="o">)</span> <span class="o">{</span>

            <span class="nx">oParentNode</span><span class="o">.</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">oMask</span><span class="o">);</span>

        <span class="o">}</span>

        <span class="k">this</span><span class="o">.</span><span class="nx">mask</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
    <span class="o">}</span>
    
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* The default event handler fired when the &quot;keylisteners&quot; property is changed.</span>
<span class="c">* @method configKeyListeners</span>
<span class="c">* @param {String} type	The CustomEvent type (usually the property name)</span>
<span class="c">* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.</span>
<span class="c">* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">configKeyListeners</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">args</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
	<span class="k">var</span> <span class="nx">listeners</span> <span class="o">=</span> <span class="nx">args</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>

	<span class="k">if</span> <span class="o">(</span><span class="nx">listeners</span><span class="o">)</span> <span class="o">{</span>
		<span class="k">if</span> <span class="o">(</span><span class="nx">listeners</span> <span class="k">instanceof</span> <span class="nb">Array</span><span class="o">)</span> <span class="o">{</span>
			<span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span><span class="nx">i</span><span class="o">&lt;</span><span class="nx">listeners</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
				<span class="k">var</span> <span class="nx">listener</span> <span class="o">=</span> <span class="nx">listeners</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>

				<span class="k">if</span> <span class="o">(!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Config</span><span class="o">.</span><span class="nx">alreadySubscribed</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">showEvent</span><span class="o">,</span> <span class="nx">listener</span><span class="o">.</span><span class="nx">enable</span><span class="o">,</span> <span class="nx">listener</span><span class="o">))</span> <span class="o">{</span>
					<span class="k">this</span><span class="o">.</span><span class="nx">showEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="nx">listener</span><span class="o">.</span><span class="nx">enable</span><span class="o">,</span> <span class="nx">listener</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
				<span class="o">}</span>
				<span class="k">if</span> <span class="o">(!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Config</span><span class="o">.</span><span class="nx">alreadySubscribed</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">hideEvent</span><span class="o">,</span> <span class="nx">listener</span><span class="o">.</span><span class="nx">disable</span><span class="o">,</span> <span class="nx">listener</span><span class="o">))</span> <span class="o">{</span>
					<span class="k">this</span><span class="o">.</span><span class="nx">hideEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="nx">listener</span><span class="o">.</span><span class="nx">disable</span><span class="o">,</span> <span class="nx">listener</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
					<span class="k">this</span><span class="o">.</span><span class="nx">destroyEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="nx">listener</span><span class="o">.</span><span class="nx">disable</span><span class="o">,</span> <span class="nx">listener</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
				<span class="o">}</span>
			<span class="o">}</span>
		<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
			<span class="k">if</span> <span class="o">(!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Config</span><span class="o">.</span><span class="nx">alreadySubscribed</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">showEvent</span><span class="o">,</span> <span class="nx">listeners</span><span class="o">.</span><span class="nx">enable</span><span class="o">,</span> <span class="nx">listeners</span><span class="o">))</span> <span class="o">{</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">showEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="nx">listeners</span><span class="o">.</span><span class="nx">enable</span><span class="o">,</span> <span class="nx">listeners</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
			<span class="o">}</span>
			<span class="k">if</span> <span class="o">(!</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Config</span><span class="o">.</span><span class="nx">alreadySubscribed</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">hideEvent</span><span class="o">,</span> <span class="nx">listeners</span><span class="o">.</span><span class="nx">disable</span><span class="o">,</span> <span class="nx">listeners</span><span class="o">))</span> <span class="o">{</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">hideEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="nx">listeners</span><span class="o">.</span><span class="nx">disable</span><span class="o">,</span> <span class="nx">listeners</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">destroyEvent</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="nx">listeners</span><span class="o">.</span><span class="nx">disable</span><span class="o">,</span> <span class="nx">listeners</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
			<span class="o">}</span>
		<span class="o">}</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* The default event handler fired when the &quot;height&quot; property is changed.</span>
<span class="c">* @method configHeight</span>
<span class="c">* @param {String} type	The CustomEvent type (usually the property name)</span>
<span class="c">* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.</span>
<span class="c">* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">configHeight</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">args</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
	<span class="k">var</span> <span class="nx">height</span> <span class="o">=</span> <span class="nx">args</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>
	<span class="k">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">innerElement</span><span class="o">;</span>
	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setStyle</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="s2">&quot;height&quot;</span><span class="o">,</span> <span class="nx">height</span><span class="o">);</span>
	<span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;underlay&quot;</span><span class="o">);</span>
	<span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;iframe&quot;</span><span class="o">);</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* The default event handler fired when the &quot;width&quot; property is changed.</span>
<span class="c">* @method configWidth</span>
<span class="c">* @param {String} type	The CustomEvent type (usually the property name)</span>
<span class="c">* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.</span>
<span class="c">* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">configWidth</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">args</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
	<span class="k">var</span> <span class="nx">width</span> <span class="o">=</span> <span class="nx">args</span><span class="o">[</span><span class="m">0</span><span class="o">];</span>
	<span class="k">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">innerElement</span><span class="o">;</span>
	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setStyle</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="s2">&quot;width&quot;</span><span class="o">,</span> <span class="nx">width</span><span class="o">);</span>
	<span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;underlay&quot;</span><span class="o">);</span>
	<span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;iframe&quot;</span><span class="o">);</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* The default event handler fired when the &quot;zIndex&quot; property is changed.</span>
<span class="c">* @method configzIndex</span>
<span class="c">* @param {String} type	The CustomEvent type (usually the property name)</span>
<span class="c">* @param {Object[]}	args	The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.</span>
<span class="c">* @param {Object} obj	The scope object. For configuration handlers, this will usually equal the owner.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">configzIndex</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">args</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">configzIndex</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">type</span><span class="o">,</span> <span class="nx">args</span><span class="o">,</span> <span class="nx">obj</span><span class="o">);</span>

	<span class="k">var</span> <span class="nx">maskZ</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
	<span class="k">var</span> <span class="nx">currentZ</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getStyle</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span> <span class="s2">&quot;zIndex&quot;</span><span class="o">);</span>

	<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">)</span> <span class="o">{</span>
		<span class="k">if</span> <span class="o">(!</span> <span class="nx">currentZ</span> <span class="o">||</span> <span class="nb">isNaN</span><span class="o">(</span><span class="nx">currentZ</span><span class="o">))</span> <span class="o">{</span>
			<span class="nx">currentZ</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
		<span class="o">}</span>

		<span class="k">if</span> <span class="o">(</span><span class="nx">currentZ</span> <span class="o">===</span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">setProperty</span><span class="o">(</span><span class="s2">&quot;zIndex&quot;</span><span class="o">,</span> <span class="m">1</span><span class="o">);</span>
		<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
			<span class="nx">maskZ</span> <span class="o">=</span> <span class="nx">currentZ</span> <span class="o">-</span> <span class="m">1</span><span class="o">;</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setStyle</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">,</span> <span class="s2">&quot;zIndex&quot;</span><span class="o">,</span> <span class="nx">maskZ</span><span class="o">);</span>
		<span class="o">}</span>

	<span class="o">}</span>
<span class="o">};</span>

<span class="c">// END BUILT-IN PROPERTY EVENT HANDLERS //</span>
<span class="c"></span>

<span class="c">/**</span>
<span class="c">* Builds the wrapping container around the Panel that is used for positioning the shadow and matte underlays. The container element is assigned to a  local instance variable called container, and the element is reinserted inside of it.</span>
<span class="c">* @method buildWrapper</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">buildWrapper</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="k">var</span> <span class="nx">elementParent</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">parentNode</span><span class="o">;</span>
	<span class="k">var</span> <span class="nx">originalElement</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">;</span>

	<span class="k">var</span> <span class="nx">wrapper</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">);</span>
	<span class="nx">wrapper</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">CSS_PANEL_CONTAINER</span><span class="o">;</span>
	<span class="nx">wrapper</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">originalElement</span><span class="o">.</span><span class="nx">id</span> <span class="o">+</span> <span class="s2">&quot;_c&quot;</span><span class="o">;</span>

	<span class="k">if</span> <span class="o">(</span><span class="nx">elementParent</span><span class="o">)</span> <span class="o">{</span>
		<span class="nx">elementParent</span><span class="o">.</span><span class="nx">insertBefore</span><span class="o">(</span><span class="nx">wrapper</span><span class="o">,</span> <span class="nx">originalElement</span><span class="o">);</span>
	<span class="o">}</span>

	<span class="nx">wrapper</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">originalElement</span><span class="o">);</span>

	<span class="k">this</span><span class="o">.</span><span class="nx">element</span> <span class="o">=</span> <span class="nx">wrapper</span><span class="o">;</span>
	<span class="k">this</span><span class="o">.</span><span class="nx">innerElement</span> <span class="o">=</span> <span class="nx">originalElement</span><span class="o">;</span>

	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">setStyle</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">innerElement</span><span class="o">,</span> <span class="s2">&quot;visibility&quot;</span><span class="o">,</span> <span class="s2">&quot;inherit&quot;</span><span class="o">);</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Adjusts the size of the shadow based on the size of the element.</span>
<span class="c">* @method sizeUnderlay</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">sizeUnderlay</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">underlay</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">browser</span> <span class="o">!=</span> <span class="s2">&quot;gecko&quot;</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">browser</span> <span class="o">!=</span> <span class="s2">&quot;safari&quot;</span><span class="o">)</span> <span class="o">{</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">underlay</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">width</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">innerElement</span><span class="o">.</span><span class="nx">offsetWidth</span> <span class="o">+</span> <span class="s2">&quot;px&quot;</span><span class="o">;</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">underlay</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">height</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">innerElement</span><span class="o">.</span><span class="nx">offsetHeight</span> <span class="o">+</span> <span class="s2">&quot;px&quot;</span><span class="o">;</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Event handler fired when the resize monitor element is resized.</span>
<span class="c">* @method onDomResize</span>
<span class="c">* @param {DOMEvent} e	The resize DOM event</span>
<span class="c">* @param {Object} obj	The scope object</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">onDomResize</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">e</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
	<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">onDomResize</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">e</span><span class="o">,</span> <span class="nx">obj</span><span class="o">);</span>
	<span class="k">var</span> <span class="nx">me</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
	<span class="nx">setTimeout</span><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>
		<span class="nx">me</span><span class="o">.</span><span class="nx">sizeUnderlay</span><span class="o">();</span>
	<span class="o">},</span> <span class="m">0</span><span class="o">);</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Registers the Panel&#39;s header for drag &amp; drop capability.</span>
<span class="c">* @method registerDragDrop</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">registerDragDrop</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">header</span><span class="o">)</span> <span class="o">{</span>

        <span class="k">if</span><span class="o">(!</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">DD</span><span class="o">)</span> <span class="o">{</span>

            <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;YAHOO.util.DD dependency not met.&quot;</span><span class="o">,</span> <span class="s2">&quot;error&quot;</span><span class="o">);</span>

            <span class="k">return</span><span class="o">;</span>
        
        <span class="o">}</span>

		<span class="k">this</span><span class="o">.</span><span class="nx">dd</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">DD</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">id</span><span class="o">);</span>

		<span class="k">if</span> <span class="o">(!</span> <span class="k">this</span><span class="o">.</span><span class="nx">header</span><span class="o">.</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
			<span class="k">this</span><span class="o">.</span><span class="nx">header</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">id</span> <span class="o">+</span> <span class="s2">&quot;_h&quot;</span><span class="o">;</span>
		<span class="o">}</span>

		<span class="k">var</span> <span class="nx">me</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>

		<span class="k">this</span><span class="o">.</span><span class="nx">dd</span><span class="o">.</span><span class="nx">startDrag</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

			<span class="k">if</span> <span class="o">(</span><span class="nx">me</span><span class="o">.</span><span class="nx">browser</span> <span class="o">==</span> <span class="s2">&quot;ie&quot;</span><span class="o">)</span> <span class="o">{</span>
				<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nx">me</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span><span class="s2">&quot;drag&quot;</span><span class="o">);</span>
			<span class="o">}</span>

			<span class="k">if</span> <span class="o">(</span><span class="nx">me</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;constraintoviewport&quot;</span><span class="o">))</span> <span class="o">{</span>
				<span class="k">var</span> <span class="nx">offsetHeight</span> <span class="o">=</span> <span class="nx">me</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">offsetHeight</span><span class="o">;</span>
				<span class="k">var</span> <span class="nx">offsetWidth</span> <span class="o">=</span> <span class="nx">me</span><span class="o">.</span><span class="nx">element</span><span class="o">.</span><span class="nx">offsetWidth</span><span class="o">;</span>

				<span class="k">var</span> <span class="nx">viewPortWidth</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getViewportWidth</span><span class="o">();</span>
				<span class="k">var</span> <span class="nx">viewPortHeight</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getViewportHeight</span><span class="o">();</span>

				<span class="k">var</span> <span class="nx">scrollX</span> <span class="o">=</span> <span class="nb">window</span><span class="o">.</span><span class="nx">scrollX</span> <span class="o">||</span> <span class="nb">document</span><span class="o">.</span><span class="nx">documentElement</span><span class="o">.</span><span class="nx">scrollLeft</span><span class="o">;</span>
				<span class="k">var</span> <span class="nx">scrollY</span> <span class="o">=</span> <span class="nb">window</span><span class="o">.</span><span class="nx">scrollY</span> <span class="o">||</span> <span class="nb">document</span><span class="o">.</span><span class="nx">documentElement</span><span class="o">.</span><span class="nx">scrollTop</span><span class="o">;</span>

				<span class="k">var</span> <span class="nx">topConstraint</span> <span class="o">=</span> <span class="nx">scrollY</span> <span class="o">+</span> <span class="m">10</span><span class="o">;</span>
				<span class="k">var</span> <span class="nx">leftConstraint</span> <span class="o">=</span> <span class="nx">scrollX</span> <span class="o">+</span> <span class="m">10</span><span class="o">;</span>
				<span class="k">var</span> <span class="nx">bottomConstraint</span> <span class="o">=</span> <span class="nx">scrollY</span> <span class="o">+</span> <span class="nx">viewPortHeight</span> <span class="o">-</span> <span class="nx">offsetHeight</span> <span class="o">-</span> <span class="m">10</span><span class="o">;</span>
				<span class="k">var</span> <span class="nx">rightConstraint</span> <span class="o">=</span> <span class="nx">scrollX</span> <span class="o">+</span> <span class="nx">viewPortWidth</span> <span class="o">-</span> <span class="nx">offsetWidth</span> <span class="o">-</span> <span class="m">10</span><span class="o">;</span>

				<span class="k">this</span><span class="o">.</span><span class="nx">minX</span> <span class="o">=</span> <span class="nx">leftConstraint</span><span class="o">;</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">maxX</span> <span class="o">=</span> <span class="nx">rightConstraint</span><span class="o">;</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">constrainX</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>

				<span class="k">this</span><span class="o">.</span><span class="nx">minY</span> <span class="o">=</span> <span class="nx">topConstraint</span><span class="o">;</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">maxY</span> <span class="o">=</span> <span class="nx">bottomConstraint</span><span class="o">;</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">constrainY</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
			<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">constrainX</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">constrainY</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
			<span class="o">}</span>

			<span class="nx">me</span><span class="o">.</span><span class="nx">dragEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="s2">&quot;startDrag&quot;</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span>
		<span class="o">};</span>

		<span class="k">this</span><span class="o">.</span><span class="nx">dd</span><span class="o">.</span><span class="nx">onDrag</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
			<span class="nx">me</span><span class="o">.</span><span class="nx">syncPosition</span><span class="o">();</span>
			<span class="nx">me</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">refireEvent</span><span class="o">(</span><span class="s2">&quot;iframe&quot;</span><span class="o">);</span>
			<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">platform</span> <span class="o">==</span> <span class="s2">&quot;mac&quot;</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">browser</span> <span class="o">==</span> <span class="s2">&quot;gecko&quot;</span><span class="o">)</span> <span class="o">{</span>
				<span class="k">this</span><span class="o">.</span><span class="nx">showMacGeckoScrollbars</span><span class="o">();</span>
			<span class="o">}</span>

			<span class="nx">me</span><span class="o">.</span><span class="nx">dragEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="s2">&quot;onDrag&quot;</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span>
		<span class="o">};</span>

		<span class="k">this</span><span class="o">.</span><span class="nx">dd</span><span class="o">.</span><span class="nx">endDrag</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
			<span class="k">if</span> <span class="o">(</span><span class="nx">me</span><span class="o">.</span><span class="nx">browser</span> <span class="o">==</span> <span class="s2">&quot;ie&quot;</span><span class="o">)</span> <span class="o">{</span>
				<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nx">me</span><span class="o">.</span><span class="nx">element</span><span class="o">,</span><span class="s2">&quot;drag&quot;</span><span class="o">);</span>
			<span class="o">}</span>

			<span class="nx">me</span><span class="o">.</span><span class="nx">dragEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="s2">&quot;endDrag&quot;</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span>
		<span class="o">};</span>

		<span class="k">this</span><span class="o">.</span><span class="nx">dd</span><span class="o">.</span><span class="nx">setHandleElId</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">header</span><span class="o">.</span><span class="nx">id</span><span class="o">);</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">dd</span><span class="o">.</span><span class="nx">addInvalidHandleType</span><span class="o">(</span><span class="s2">&quot;INPUT&quot;</span><span class="o">);</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">dd</span><span class="o">.</span><span class="nx">addInvalidHandleType</span><span class="o">(</span><span class="s2">&quot;SELECT&quot;</span><span class="o">);</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">dd</span><span class="o">.</span><span class="nx">addInvalidHandleType</span><span class="o">(</span><span class="s2">&quot;TEXTAREA&quot;</span><span class="o">);</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Builds the mask that is laid over the document when the Panel is configured to be modal.</span>
<span class="c">* @method buildMask</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">buildMask</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="k">if</span> <span class="o">(!</span> <span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">)</span> <span class="o">{</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">mask</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">createElement</span><span class="o">(</span><span class="s2">&quot;div&quot;</span><span class="o">);</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">id</span> <span class="o">+</span> <span class="s2">&quot;_mask&quot;</span><span class="o">;</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;mask&quot;</span><span class="o">;</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">&quot;&amp;#160;&quot;</span><span class="o">;</span>

		<span class="k">var</span> <span class="nx">maskClick</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">e</span><span class="o">,</span> <span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
			<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">stopEvent</span><span class="o">(</span><span class="nx">e</span><span class="o">);</span>
		<span class="o">};</span>

		<span class="k">var</span> <span class="nx">firstChild</span> <span class="o">=</span> <span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">;</span>
		<span class="k">if</span> <span class="o">(</span><span class="nx">firstChild</span><span class="o">)</span>	<span class="o">{</span>
			<span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">insertBefore</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">,</span> <span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">firstChild</span><span class="o">);</span>
		<span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
			<span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">);</span>
		<span class="o">}</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Hides the modality mask.</span>
<span class="c">* @method hideMask</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">hideMask</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;modal&quot;</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">)</span> <span class="o">{</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;none&quot;</span><span class="o">;</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">hideMaskEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">();</span>
		<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">,</span> <span class="s2">&quot;masked&quot;</span><span class="o">);</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Shows the modality mask.</span>
<span class="c">* @method showMask</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">showMask</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">cfg</span><span class="o">.</span><span class="nx">getProperty</span><span class="o">(</span><span class="s2">&quot;modal&quot;</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">)</span> <span class="o">{</span>
		<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="nb">document</span><span class="o">.</span><span class="nx">body</span><span class="o">,</span> <span class="s2">&quot;masked&quot;</span><span class="o">);</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">sizeMask</span><span class="o">();</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">display</span> <span class="o">=</span> <span class="s2">&quot;block&quot;</span><span class="o">;</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">showMaskEvent</span><span class="o">.</span><span class="nx">fire</span><span class="o">();</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Sets the size of the modality mask to cover the entire scrollable area of the document</span>
<span class="c">* @method sizeMask</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">sizeMask</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">)</span> <span class="o">{</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getDocumentHeight</span><span class="o">()+</span><span class="s2">&quot;px&quot;</span><span class="o">;</span>
		<span class="k">this</span><span class="o">.</span><span class="nx">mask</span><span class="o">.</span><span class="nx">style</span><span class="o">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">.</span><span class="nx">getDocumentWidth</span><span class="o">()+</span><span class="s2">&quot;px&quot;</span><span class="o">;</span>
	<span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Renders the Panel by inserting the elements that are not already in the main Panel into their correct places. Optionally appends the Panel to the specified node prior to the render&#39;s execution. NOTE: For Panels without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.</span>
<span class="c">* @method render</span>
<span class="c">* @param {String}	appendToNode	The element id to which the Module should be appended to prior to rendering &lt;em&gt;OR&lt;/em&gt;</span>
<span class="c">* @param {HTMLElement}	appendToNode	The element to which the Module should be appended to prior to rendering</span>
<span class="c">* @return {boolean} Success or failure of the render</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">render</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">appendToNode</span><span class="o">)</span> <span class="o">{</span>
	<span class="k">return</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">render</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">appendToNode</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">innerElement</span><span class="o">);</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Removes the Panel element from the DOM and sets all child elements to null.</span>
<span class="c">* @method destroy</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">destroy</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>

    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Overlay</span><span class="o">.</span><span class="nx">windowResizeEvent</span><span class="o">.</span><span class="nx">unsubscribe</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">sizeMask</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>

    <span class="k">if</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">)</span> <span class="o">{</span>
    
        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">purgeElement</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">close</span><span class="o">);</span>

    <span class="o">}</span>

    <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">superclass</span><span class="o">.</span><span class="nx">destroy</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>  

<span class="o">};</span>

<span class="c">/**</span>
<span class="c">* Returns a String representation of the object.</span>
<span class="c">* @method toString</span>
<span class="c">* @return {String} The string representation of the Panel.</span>
<span class="c">*/</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Panel</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">toString</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
	<span class="k">return</span> <span class="s2">&quot;Panel &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">id</span><span class="o">;</span>
<span class="o">};</span>
</pre></div>
                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div class="module">
                        <h4>Modules</h4>
                        <ul class="content">

                                <li class=""><a href="module_animation.html">animation</a></li>

                                <li class=""><a href="module_autocomplete.html">autocomplete</a></li>

                                <li class=""><a href="module_button.html">button</a></li>

                                <li class=""><a href="module_calendar.html">calendar</a></li>

                                <li class=""><a href="module_connection.html">connection</a></li>

                                <li class="selected"><a href="module_container.html">container</a></li>

                                <li class=""><a href="module_datasource.html">datasource</a></li>

                                <li class=""><a href="module_datatable.html">datatable</a></li>

                                <li class=""><a href="module_dom.html">dom</a></li>

                                <li class=""><a href="module_dragdrop.html">dragdrop</a></li>

                                <li class=""><a href="module_element.html">element</a></li>

                                <li class=""><a href="module_event.html">event</a></li>

                                <li class=""><a href="module_history.html">history</a></li>

                                <li class=""><a href="module_logger.html">logger</a></li>

                                <li class=""><a href="module_menu.html">menu</a></li>

                                <li class=""><a href="module_slider.html">slider</a></li>

                                <li class=""><a href="module_tabview.html">tabview</a></li>

                                <li class=""><a href="module_treeview.html">treeview</a></li>

                                <li class=""><a href="module_yahoo.html">yahoo</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="YAHOO.util.Config.html">YAHOO.util.Config</a></li>
                                <li class=""><a href="YAHOO.widget.ContainerEffect.html">YAHOO.widget.ContainerEffect</a></li>
                                <li class=""><a href="YAHOO.widget.Dialog.html">YAHOO.widget.Dialog</a></li>
                                <li class=""><a href="YAHOO.widget.Module.html">YAHOO.widget.Module</a></li>
                                <li class=""><a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a></li>
                                <li class=""><a href="YAHOO.widget.OverlayManager.html">YAHOO.widget.OverlayManager</a></li>
                                <li class=""><a href="YAHOO.widget.Panel.html">YAHOO.widget.Panel</a></li>
                                <li class=""><a href="YAHOO.widget.SimpleDialog.html">YAHOO.widget.SimpleDialog</a></li>
                                <li class=""><a href="YAHOO.widget.Tooltip.html">YAHOO.widget.Tooltip</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="Config.js.html">Config.js</a></li>
                                <li class=""><a href="ContainerEffect.js.html">ContainerEffect.js</a></li>
                                <li class=""><a href="Dialog.js.html">Dialog.js</a></li>
                                <li class=""><a href="Module.js.html">Module.js</a></li>
                                <li class=""><a href="Overlay.js.html">Overlay.js</a></li>
                                <li class=""><a href="OverlayManager.js.html">OverlayManager.js</a></li>
                                <li class="selected"><a href="Panel.js.html">Panel.js</a></li>
                                <li class=""><a href="SimpleDialog.js.html">SimpleDialog.js</a></li>
                                <li class=""><a href="Tooltip.js.html">Tooltip.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2007 Yahoo! Inc. All rights reserved.
	</div>
</div>
</body>
</html>
